


var db = require('../db');
var webResult = require('../web-result');
var router = require('express').Router();


router.get("/avatar/:id", async (request, response) => {
    const { id } = request.params;
    db.query("select * from avatar where id = ?", [id])
    .then(result => {
        if (!result)
        {
            response.send(webResult.failed(undefined, "头像不存在"));
            return;
        }

        const avatar = result[0];
        response.send(webResult.success(avatar, "获取成功"));
    });
});


module.exports = router;


